package com.barry.oscheckpoint;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText; 
import android.widget.TextView;
//http://www.androidhive.info/2012/07/android-gps-location-manager-tutorial/
public class  OSCheckPointMain extends Activity {
    
   Button btnShowLocation;
   TextView textView1;
   EditText editText1;
   // GPSTracker class
   GPSTracker gps;
    //53.387537, -2.348521
   //ridge 963 874 
   //bridge 965 869
   @Override
   public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_oscheck_point_main);
       btnShowLocation = (Button)   findViewById(R.id.btnShowLocation);
       textView1       = (TextView) findViewById(R.id.textView1);
       editText1       = (EditText) findViewById(R.id.editText1);
	   editText1.setText("Launched");

	 // show location button click event
    btnShowLocation.setOnClickListener(new View.OnClickListener() {
         
        @Override
        public void onClick(View arg0) {        
            // create class object
     	   editText1.setText(System.getProperty("user.dir")); 
     	  ReadCSV.ReadOSGridCSVFile( System.getProperty("user.dir") + "/bin/classes/Files/" + "FoxesRun");
            gps = new GPSTracker(OSCheckPointMain.this);

            // check if GPS enabled     
            if(gps.canGetLocation()){
              //  Toast.makeText(getApplicationContext(),locationStr, Toast.LENGTH_LONG ).show();    
             
            }else{
                // can't get location
                // GPS or Network is not enabled
                // Ask user to enable GPS/network in settings
                gps.showSettingsAlert();
            }
             
        }
    });
    
   
}

}
